package util;

import java.io.File;

import org.apache.poi.hwpf.HWPFDocument;

public class MainTest {
	
	public static void main(String[] args) throws Exception{
		String sp= File.separator;
		String FilePath = System.getProperty("user.dir")+sp+"document"+sp+"test2.doc";
		String path = System.getProperty("user.dir")+sp+"document"+sp;
		FilePath = "/home/flag/test.doc";
		ODocument odoc = new ODocument(FilePath);
		writeHtml(odoc,path);
		//writeXml(odoc,path);
		System.out.println("OK!");
	}
	
	public static void writeHtml(ODocument doc,String path){
		OTable otable = new OTable(doc.getDocument());
		String htmlData = otable.replaceHtmlTable(doc.readDoc());
		OImage oimage = new OImage(doc.getDocument(),path);
		htmlData = oimage.replaceImg(htmlData);
		OPrint oprint = new OPrint();
		//oprint.printHtml(htmlData, path,"");
		
	}
	public static void writeXml(ODocument doc,String path){
		OTable otable = new OTable(doc.getDocument());
		String xmlData = otable.replaceXmlTable(doc.readDoc());
		OImage oimage = new OImage(doc.getDocument(),path);
		xmlData = oimage.replaceImg(xmlData);
		OPrint oprint = new OPrint();
		oprint.printXml(xmlData, path);
	}

}
